import java.sql.*;

public class Test2 {
    static final String JDBC_DRIVER ="com.mysql.cj.jdbc.Driver";
    static final String DB_RUL = "jdbc:mysql://localhost:3306/company";
    static final String USER ="root";
    public static void main(String[] args) {
        try {
            Class.forName(JDBC_DRIVER);
        } catch (ClassNotFoundException e) {
            throw new RuntimeException(e);
        }
        try (
            Connection coon = DriverManager.getConnection(DB_RUL, USER,"");
            Statement stat = coon.createStatement()){
            String string = "delete from dept where deptno = 50";
            int i = stat.executeUpdate(string);
            if (i >= 1){
                System.out.println("成功");
            }else {
                System.out.println("失败");
            }
        } catch (SQLException e) {
            throw new RuntimeException(e);
        }

    }
}
